package com.ht.medicaltreatment.viewmodel

import com.hjq.http.EasyHttp
import com.hjq.http.listener.OnHttpListener
import com.ht.medicaltreatment.bean.HaoCaiListBean
import com.ht.medicaltreatment.http.api.HaoCaiListAPI

class HaoCaiListViewModel : BaseViewModel(){
    fun getList(page:String,numberName:String,onResult:(HaoCaiListBean)->Unit){
        EasyHttp.post(this)
            .api(HaoCaiListAPI(page,"20",numberName))
            .request(object : OnHttpListener<HaoCaiListBean>{
                override fun onHttpSuccess(result: HaoCaiListBean) {
                    if(result.code == 200){
                        onResult(result)
                    }else{
                        dismissProgress(result.message)
                    }
                }

                override fun onHttpFail(e: Exception?) {

                }
            })
    }
}
